home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / mail / aolmail.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  5KB  |  137 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from util import UrlQuery, threaded
  5. import common
  6. import mail
  7. from mail.imap import IMAPMail
  8. from common import pref
  9. import time
  10. import logging
  11. log = logging.getLogger('aolmail')
  12.  
  13. class AOLMail(IMAPMail):
  14.     protocol = 'aolmail'
  15.     default_domain = 'aol.com'
  16.     AIM_SERVER = 'imap.aol.com'
  17.     
  18.     def __init__(self, *a, **kws):
  19.         print 'AOL Constructor'
  20.         print a, kws
  21.         self._name = None
  22.         kws.update(dict(imapserver = self.AIM_SERVER))
  23.         IMAPMail.__init__(self, *a, **kws)
  24.  
  25.     get_email_address = common.emailaccount.EmailAccount.get_email_address
  26.     
  27.     def _get_name(self):
  28.         return self._name
  29.  
  30.     
  31.     def _set_name(self, name):
  32.         if '@aol.' in name:
  33.             name = name.split('@aol.')[0]
  34.         elif '@aim.' in name:
  35.             name = name.split('@aim.')[0]
  36.         
  37.         self._name = name
  38.  
  39.     name = property(_get_name, _set_name)
  40.     
  41.     def _get_mailclient(self):
  42.         return pref('privacy.www_auto_signin', False)
  43.  
  44.     
  45.     def _not_supported(self, val):
  46.         pass
  47.  
  48.     mailclient = property(_get_mailclient, _not_supported)
  49.     can_has_preview = True
  50.     
  51.     def reportSpam(self, msg):
  52.         IMAPMail.reportSpam(self, msg)
  53.         self.move(msg, 'Spam')
  54.  
  55.     
  56.     def delete(self, msg):
  57.         IMAPMail.delete(self, msg)
  58.         self.move(msg, 'Trash')
  59.  
  60.     
  61.     def archive(self, msg):
  62.         IMAPMail.archive(self, msg)
  63.         self.move(msg, 'Saved Mail')
  64.  
  65.     
  66.     def open(self, msg):
  67.         OpenAOLMail(self.name, self._decryptedpw(), msg.id)
  68.  
  69.     
  70.     def urlForEmail(self, msg):
  71.         return UrlQuery('http://webmail.aol.com/Lite/MsgRead.aspx?', dict(folder = 'Inbox', uid = '1.' + msg.id, seq = '1', start = '0'))
  72.  
  73.     
  74.     def compose(self, to = '', subject = '', body = '', cc = '', bcc = '', **k):
  75.         if self.mailclient:
  76.             print 'edit compose', to, subject, body, cc, bcc, k
  77.             body = body.replace('\n', '<br>')
  78.             ComposeAOLMail(self.name, self._decryptedpw(), to = to, subject = subject, body = body, **k)
  79.             print 'edit compose', 'done'
  80.         else:
  81.             print 'return url'
  82.             return self._compose(to, subject, body, cc, bcc, **k)
  83.  
  84.     
  85.     def _compose(self, to = '', subject = '', body = '', cc = '', bcc = '', **k):
  86.         return UrlQuery('http://webmail.aol.com/25045/aim/en-us/Mail/compose-message.aspx', to = to, subject = subject, body = body, cc = cc, bcc = bcc, **k)
  87.  
  88.     
  89.     def inbox_url(self):
  90.         return 'http://mail.aol.com'
  91.  
  92.     inbox_url = property(inbox_url)
  93.     
  94.     def goto_inbox(self):
  95.         if self.mailclient:
  96.             SelectAOLMail(self.name, self._decryptedpw())
  97.         
  98.  
  99.     
  100.     def start_client_email(self, email = None):
  101.         if email is not None:
  102.             self.open(email)
  103.         else:
  104.             self.goto_inbox()
  105.  
  106.     
  107.     def _get_options(self):
  108.         opts = IMAPMail._get_options(self)
  109.         opts.pop('email_address', None)
  110.         opts.pop('mailclient', None)
  111.         return opts
  112.  
  113.  
  114.  
  115. def OpenAOLMail(un, password, msgid):
  116.     login2 = login2
  117.     import oscar
  118.     login2.go_to_msg(un.encode('utf-8'), password.encode('utf-8'), msgid)
  119.  
  120.  
  121. def SelectAOLMail(un, password):
  122.     login2 = login2
  123.     import oscar
  124.     print 'opening', un
  125.     login2.go_to_mail(un.encode('utf-8'), password.encode('utf-8'))
  126.  
  127.  
  128. def ComposeAOLMail(un, password, **k):
  129.     login2 = login2
  130.     import oscar
  131.     login2.go_to_compose(un.encode('utf-8'), password.encode('utf-8'), **k)
  132.  
  133. if __name__ == '__main__':
  134.     from wx.py.PyCrust import main
  135.     main()
  136.  
  137.